home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 13 / 013.d81 / loadstar polydiv (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  4KB  |  144 lines

  1. 1 rem  loadstar polydiv
  2. 2 gosub20000
  3. 5 d$=""
  4. 10 print"[147]":poke53281,0
  5. 20 dim p1(8),p2(8),a(8),b(8),q(16)
  6. 25 fori=0to8:p1(i)=0:p2(i)=0:next
  7. 1000 print"[147]"
  8. 1005 print"'_' to [197][216][201][212]"
  9. 1010 print"[197][206][212][197][210] [217][207][213][210] [208][207][204][217][206][207][205][201][193][204]:"
  10. 1011 print:print"[198][207][210][205][213][204][193]:     [208][207][204][217][206][207][205][201][193][204]#1"
  11. 1012 l$="--------------"
  12. 1013 printspc(12)l$
  13. 1014 print"             [208][207][204][217][206][207][205][201][193][204]#2"
  14. 1015 print:print
  15. 1020 print"[197][216][193][205][208][204][197]:      3   2"
  16. 1030 print"            3[216] +2[216] -[216]+10"
  17. 1035 print"[206]o exponents greater than 8 are allowed."
  18. 1055 p=1
  19. 1060 gosub1999
  20. 1070 fori=0to8:p1(i)=a(i):next
  21. 1080 p=2:gosub1999
  22. 1090 fori=0to8:p2(i)=a(i):next
  23. 1100 print"[147]"
  24. 1110 v=3:p=1
  25. 1120 fori=0to8:b(i)=p1(i):next
  26. 1130 gosub3000
  27. 1135 print:print"         [196][201][214][201][196][197][196][160][194][217]:"
  28. 1140 v=11:p=2
  29. 1150 fori=0to8:b(i)=p2(i):next
  30. 1160 gosub3000
  31. 1200 fori=8to0step-1:ifp1(i)=0thennext
  32. 1210 n1=i
  33. 1220 fori=8to0step-1:ifp2(i)=0thennext
  34. 1230 n2=i
  35. 1500 fori=0to16:q(i)=0:next
  36. 1505 q(n1)=p1(n1)
  37. 1510 fori=n1-1to0step-1
  38. 1515 q(i)=p1(i)
  39. 1520 forj=0ton2-1
  40. 1521 ifi<jthen1530
  41. 1525 q(i)=q(i)-p2(j)*q(i+n2-j)
  42. 1530 nextj:nexti
  43. 1532 :
  44. 1533 printleft$(d$,14);"[209][213][207][212][201][197][206][212]       :  ";:i1=n1:i2=n2:gosub1550
  45. 1534 printleft$(d$,19);"[210][197][205][193][201][206][196][197][210][160]    :  ";:i1=n2-1:i2=0:gosub1550
  46. 1535 printleft$(d$,23);"[193][206][207][212][200][197][210][160](y/n) ";
  47. 1536 poke198,0:wait198,1:geta$:ifa$="y"then1000
  48. 1537 ifa$="n"then1540
  49. 1538 goto1536
  50. 1539 :
  51. 1540 print"[147][193]re you sure you want to quit?"
  52. 1541 poke198,0:wait198,1:geta$:ifa$<>"y"anda$<>"n"thenpoke53280,rnd(1)*15:goto1541
  53. 1542 ifa$="n"thenrun5
  54. 1543 print"[147]load"chr$(34)"hello"chr$(34)",8":print"run"
  55. 1544 poke631,13:poke632,13:poke198,2:end
  56. 1545 :
  57. 1546 :
  58. 1550 rem print the answer
  59. 1570 l=0:cl=0:fori=i1toi2step-1:fl=0
  60. 1580 j=i-i2
  61. 1590 ifq(i)=0then1630
  62. 1600 ifi<i1andq(i)>0thenprint"+ ";:l=l+2     :fl=1
  63. 1602 ifi<i1andq(i)<0thenl=l+2:fl=1
  64. 1605 ifi>i2andq(i)=1then1620
  65. 1610 printmid$(str$(q(i)),1);:               l=l+len(str$(q(i)))
  66. 1620 ifj>0thenprint"[216]";:l=l+1:               ifj>1thenprint"[145][157]";j;"";:l=l+2
  67. 1625 ifl>20andfl=1andcl=0thenprint:          print:l=0:cl=1
  68. 1630 next
  69. 1650 print
  70. 1700 return
  71. 1997 :
  72. 1998 end
  73. 1999 fori=0to8:a(i)=0:next
  74. 2000 print""
  75. 2001 print"[208][207][204][217][206][207][205][201][193][204]#"p":":print
  76. 2002 print"--> ";:x=9:t=0:a2$=""
  77. 2003 ab$="":ac$="":aa=0
  78. 2005 ifa2$="-"thenab$="-"
  79. 2006 ifa2$="+"thenab$="+"
  80. 2009 poke198,0:wait198,1:geta1$:ifa1$="x"then2050
  81. 2010 ifa1$="-"andlen(ab$)=0then2020
  82. 2011 ifa1$=chr$(13)thenaa=1:ac$="0"
  83. 2012 ifa1$=chr$(13)then2110
  84. 2013 ifa1$="0"andval(ab$)<>0then2020
  85. 2014 ifa1$=chr$(95)then1540
  86. 2015 :
  87. 2016 ifval(a1$)=0then2009
  88. 2020 ab$=ab$+a1$:printa1$;:goto2009
  89. 2050 print"[216][145]";
  90. 2060 poke198,0:wait198,1
  91. 2070 geta2$:ifa2$="+"ora2$="-"then2100
  92. 2072 ifa2$=chr$(13)thenaa=1:goto2110
  93. 2073 ifa2$="0"andval(ac$)>0then2090
  94. 2074 ifa2$=chr$(27)then99:rem[pop]
  95. 2075 ifa2$=chr$(27)then1538
  96. 2080 ifval(a2$)=0then2070
  97. 2090 ac$=ac$+a2$:printa2$;:goto2070
  98. 2100 print"";
  99. 2101 printa2$;
  100. 2110 ifab$=""orab$="-"orab$="+"thenab$=ab$+"1"
  101. 2120 ifac$=""thenac$="1"
  102. 2125 ifval(ac$)>x-1then10000
  103. 2127 ifa(val(ac$))<>0then10000
  104. 2130 a(val(ac$))=val(ab$)
  105. 2135 x=val(ac$)
  106. 2136 ift=oandp=2andval(ab$)<>1thenprint:goto2540
  107. 2140 ifaa=1then2500
  108. 2150 t=1:goto2003
  109. 2500 print:print"[201]s this correct?";
  110. 2510 poke198,0:wait198,1:geta$:ifa$="y"ora$="n"then2530
  111. 2520 goto2510
  112. 2530 ifa$="y"thenprint"[145]"
  113. 2531 ifa$="y"thenprint"                     [145][145]";
  114. 2532 ifa$="y"thenreturn
  115. 2540 print"[145][145][145]":fori=0to3
  116. 2541 print"                                       "
  117. 2542 next:print"[145][145][145][145][145][145][145][145]";:goto1999
  118. 3000 printleft$(d$,v);"[208][207][204][217][206][207][205][201][193][204] #"p":  ";
  119. 3010 l=0:cl=0:fori=8to0step-1
  120. 3012 fl=0
  121. 3020 ifb(i)=0then3080
  122. 3030 ifi>0andabs(b(i))<>1thenprintmid$(str$(b(i)),1);:l=l+len(str$(b(i)))
  123. 3040 ifi>0thenprint"[216]";:l=l+1:               ifi>1thenprint"[145][157]"i"";:l=l+1
  124. 3050 ifi>0thenifb(i-1)<0then                 l=l+2:fl=1
  125. 3060 ifi>0thenifb(i-1)>0thenprint"+ ";:      l=l+2:fl=1
  126. 3070 ifi=0thenprintmid$(str$(b(i)),1);:      l=l+len(str$(b(i)))
  127. 3075 ifl>20andfl=1andcl=0thenprint:print     :l=0:cl=1
  128. 3080 next
  129. 3090 return
  130. 10000 print"":goto2540
  131. 20000 t$="                         ":c=0:c$="":print"[147]":poke53281,0
  132. 20030 printspc(7)""t$:print                 spc(7)"  [204][207][193][196][211][212][193][210] [208][207][204][217][196][201][214][201][211][201][207][206]  [146]"
  133. 20051 printspc(7)""t$:print:printtab(18)"by"
  134. 20060 print:printspc(12)"[194]ryan [214]ekovius"
  135. 20065 print:print" [195]onverted to the [195]-64 by [193]lan [199]ardner"
  136. 20070 print:printspc(12)"[195]opyright 1985"
  137. 20080 print:print:print:print"     [204][207][193][196][211][212][193][210] is not public domain."
  138. 20090 print:print"  [208]lease respect the author's rights."
  139. 20100 print:print"      [208]ress space bar to continue."
  140. 20110 forcc=1to48:getk$:ifk$=" "then20130
  141. 20120 ifcc=1thenprintmid$(c$,c+2,1)"[145][145]";:c=not(c)
  142. 20125 next:goto20100
  143. 20130 printc$:return
  144.